﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

/// <summary>
///     原始文件中的布尔类型值，<see langword="true" />或<see langword="false" />
/// </summary>
public class SourceBoolean : PreExpression
{
    internal SourceBoolean(SourceNode? parent) : base(parent, SyntaxKinds.Boolean)
    {
    }
}

public static partial class NodeFactory
{
    public static SourceBoolean CreateSourceBoolean(SourceNode source)
    {
        Debug.Assert(source.IsOneOfNode(SyntaxKinds.TrueKeywordToken, SyntaxKinds.FalseKeywordToken));
        SourceBoolean boolean = new(null);
        boolean.UpdateFrom(source);
        boolean.UpdateValue(source.IsNode(SyntaxKinds.TrueKeywordToken));
        boolean.SetFlags(source.GetFlags());
        return boolean;
    }
}